<?php
function getIPLocation($ip="")
{
	$location=file_get_contents("http://api.hostip.info/?ip=".$ip);
	preg_match_all("/<gml:name>(.*?)<\/gml:name>/ims",$location,$city);
	$city=$city[1][1];
	preg_match("/<countryName>(.*?)<\/countryName>/ims",$location,$country);
	$country=$country[1];
	return array("city"=>$city,"country"=>$country);
}